  <div data-am-widget="tabs" data-am-tabs="{noSwipe: 1}" class="am-tabs am-tabs-default">
      <ul class="am-tabs-nav am-cf">
          <li class="am-active"><a href="#">提现</a></li>
          <li class=""><a href="#">提现记录</a></li>
          <li class="xx"></li>
      </ul>
      <div class="am-tabs-bd withdrawal log">
          <div data-tab-panel-0 class="am-tab-panel am-active">
              <div class="el-tabs__content" style="margin: 30px 5px 10px 5px;">
                  <div class="el-tab-pane">
                      <div class="drawbox">
                          <div class="step"></div> 
                              <div id="nobind" class="wrap" style="display: none">
                                <p class="addcard">添加一张银行卡开始提款吧
                                    <a href="javascript:void(0)" id="addCard"></a>
                                </p>
                              </div> 
                            
                              <!-- 银行卡绑定 -->
                              <div id="bindnow" class="wrap" style="display: none">
                                <p class="bindtit">
                                    为了保障会员资金安全，绑定的银行卡开户名必须为注册时填写的真实姓名，否则提款会失败。
                                </p> 
                                <div class="drawform"><div class="el-form">
                                    <div class="el-form-item is-required">
                                        <label for="cardUserName" class="el-form-item__label" style="width: 100px;">持卡人账号</label>
                                        <div class="el-form-item__content" style="margin-left: 100px;">
                                            <div class="el-input is-disabled">
                                                <input name="realname" autocomplete="off" disabled="disabled" type="text" rows="2" validateevent="true" class="el-input__inner">
                                            </div>
                                        </div>
                                    </div> 
                                    
                                    <div class="el-form-item is-required">
                                        <label for="bank" class="el-form-item__label" style="width: 100px;">选择银行</label>
                                        <div class="el-form-item__content" style="margin-left: 100px;">
                                            <select class="el-select banklist" denyau="1">
                                            </select>
                                        </div>
                                    </div>
                                    
                                    <div class="el-form-item is-required">
                                        <label for="cardNum" class="el-form-item__label" style="width: 100px;">银行卡号</label>
                                        <div class="el-form-item__content" style="margin-left: 100px;">
                                            <div class="el-input">
                                                <input name="bank-account" autocomplete="off" type="number" rows="2" validateevent="true" class="el-input__inner">
                                            </div>
                                        </div>
                                    </div> 
                                    <div class="el-form-item is-required">
                                        <label for="bankInitiator" class="el-form-item__label" style="width: 100px;">开户支行</label>
                                        <div class="el-form-item__content" style="margin-left: 100px;">
                                            <div class="el-input">
                                                <input name="bank-addr" autocomplete="off" type="text" rows="2" validateevent="true" class="el-input__inner">
                                            </div>
                                        </div>
                                    </div> 
                                    
                                    <div class="el-form-item">
                                        <div class="el-form-item__content" style="margin-left: 100px;">
                                            <button type="submit" class="profile-button el-button el-button--warning el-button--small bind-bank">
                                                <span>提交</span>
                                            </button>
                                        </div>
                                    </div>
                                </div></div>
                              </div>
                            
                              <div id="draw" class="wrap">
                                <div class="drawform">
                                    <div class="el-form">
                                        <div class="el-form-item cardchoese">
                                            <label class="el-form-item__label" style="width: 100px;">银行卡号</label>
                                            <div class="el-form-item__content" style="margin-left: 100px;">
                                                <div>
                                                    <input type="radio" checked="checked"> 
                                                    <span id="bankInfo">农业银行 （尾号：6789）</span> 
                                                    <a href="javascript:void(0);" id="rebind">重新绑定</a>
                                                </div>
                                            </div>
                                        </div> 
                                        
                                        <div class="el-form-item is-required">
                                            <label for="amount" class="el-form-item__label" style="width: 100px;">提现金额</label>
                                            <div class="el-form-item__content" style="margin-left: 100px;">
                                                <div class="el-input">
                                                    <input name="amount" autocomplete="off" type="number" rows="2" validateevent="true" class="el-input__inner">
                                                </div>
                                            </div>
                                        </div> 
                                        
                                        <div class="el-form-item is-required">
                                            <label for="fundPwd" class="el-form-item__label" style="width: 100px;">提现密码</label>
                                            <div class="el-form-item__content" style="margin-left: 100px;">
                                                <div class="el-input">
                                                    <input name="password" autocomplete="off" type="password" rows="2" maxlength="4" validateevent="true" class="el-input__inner">
                                                </div>
                                            </div>
                                        </div> 
                                        
                                        <div class="el-form-item">
                                            <div class="el-form-item__content" style="margin-left: 100px;">
                                                <button type="submit" class="profile-button el-button el-button--warning el-button--small"><span>提交</span></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                              </div>
                        </div>
                  </div>
              </div>
          </div>

          <div data-tab-panel-1 class="am-tab-panel">
              <div class="filter">
                  <div class="f1 item">
                      <select>
                        <option value="-1">全部状态</option>
                        <option value="0">待处理</option>
                        <option value="1">成功</option>
                        <option value="2">失败</option>
                      </select>
                  </div>
                  <div class="f2 item">
                      <input type="text" placeholder="开始时间"/>
                  </div>
                  <div class="f3 item">
                      <input type="text" placeholder="开始时间"/>
                  </div>
                  <div class="item f10">
                      <button class="btn">查询</button>
                  </div>
              </div>

              <div style="margin: 5px 5px 5px 5px;"><table class="zy-table">
                <thead>
                    <tr>
                        <th>订单号</th>
                        <th>提交时间</th>
                        <th>审核时间</th>
                        <th>金额</th>
                        <th>状态描述</th>
                        <th>单据状态</th>
                    </tr>
                </thead>
                <tbody>
                    <tr><td colspan="6">暂无数据！</td></tr>
                </tbody>
              </table></div>

              <div class="el-pagination zxf_pagediv">
              </div>
          </div>
      </div>
  </div>

<script>
    $(".tabs").tabs();

    // 如果用户没有绑定银行卡号，则显示添加银行卡的界面
    var bank = context.user.user.bank;
    if (bank) bank = JSON.parse(bank);
    if (Util.isEmpty(bank) || !bank.account) {
        $("#draw").hide();
        $("#nobind").show();
        $("#bindnow").hide();
    }
    else {
        $("#draw").show();
        $("#nobind").hide();
        $("#bindnow").hide();
    }
    
    $("#addCard").click(function() {
        // 切换到添加银行的页面
        $("#nobind").hide();
        $("#bindnow").show();
    });
    $("#rebind").click(function() {
        $("#draw").hide();
        $("#bindnow").show();
    })

    // 填充银行列表
    Util.fillBanks($("#bindnow .banklist"));

    // 填充账户相关信息
    if (!Util.isEmpty(bank) && bank.account) {
        $("#bankInfo").html(bank.bank + " (尾号：" + bank.account.substring(bank.account.length - 4) + ")");
    }
    $("#bindnow input[name='realname']").val(context.user.user.name || '');

    // 绑定银行卡号的处理
    $("#bindnow .profile-button").click(function() {
        var bank_account = $("#bindnow input[name='bank-account']").val().trim();
        if (!bank_account) {
            alert2("请输入银行卡号", true);
            return;
        }

        var bank_addr = $("#bindnow input[name='bank-addr']").val().trim();
        if (!bank_addr) {
            alert2("请输入开户网点", true);
            return;
        }
        bank = {
            bank: $("#bindnow .banklist").val(),
            account: bank_account,
            addr: bank_addr,
        };
        CMD.modify_user_info(undefined, {
            bank: JSON.stringify(bank),
        }, function() {
            alert2("绑定银行卡成功", false);
        });
    });

    // 申请提款的处理
    $("#draw .profile-button").click(function() {
        var amount = $("#draw input[name='amount']").val();
        if (amount == '') return;
        amount = parseInt(amount);
        if (amount < 1) {
            alert2("金额不能少于1", true);
            return;
        }

        if (context.user.balance < amount * 100) {
            alert2("余额不足", true);
            return;
        }

        // 检测取款密码
        var p = $("#draw input[name='password']").val().trim();
        if (p != context.user.user.tpassword && context.user.user.tpassword) {
            alert2("取款密码错误", true);
            return;
        }

        bank = JSON.parse(context.user.user.bank);
        var memo = {
            bank: bank.bank,
            addr: bank.addr,
            account: bank.account,
        }
        CMD.withdraw(context.user.user.id, "", amount*100, memo, function() {
            alert2("申请成功，请等待审核", false);
            ME.query();
        }, function(message) {
            alert2("提交失败，错误原因：" + message, true);
            ME.query();
        });
    });

    withdrawLog();
</script>